package com.example.service.impl;

import com.example.mapper.DeptLogMapper;
import com.example.pojo.DeptLog;
import com.example.service.DeptLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;

@Service
public class DeptLogImpl implements DeptLogService {
    @Autowired
    private DeptLogMapper deptLogMapper;

    // Propagation.REQUIRED 默认值：需要事务，有则加入，无则创建新事务
    @Transactional(propagation =Propagation.REQUIRES_NEW )//需要新事物，无论有无，总是创建新事务
    @Override
    public void insert(DeptLog deptLog) {
        deptLogMapper.insert(deptLog);
    }
}
